<?php /* Smarty version Smarty-3.1.14, created on 2017-08-21 08:36:36
         compiled from "E:\phpStudy\WWW\zyshop\admin\templates\users_edit.html" */ ?>
<?php /*%%SmartyHeaderCode:25225994ff292e2a03-31331526%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ef3281a6be3823ca924879085e149cbdc0a2e2b4' => 
    array (
      0 => 'E:\\phpStudy\\WWW\\zyshop\\admin\\templates\\users_edit.html',
      1 => 1503104838,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '25225994ff292e2a03-31331526',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_5994ff2932b238_89275888',
  'variables' => 
  array (
    'user_edit' => 0,
    'user_rank' => 0,
    'ranks' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5994ff2932b238_89275888')) {function content_5994ff2932b238_89275888($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<style>
input {	width: 200px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>添加会员</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="users.php" enctype="multipart/form-data" id="aspnetForm" name="form1">
    <table style=" width:100%;" cellpadding="0" cellspacing="0" class="table tb-type2">
      <tbody>
        <tr>
          <td class="firtd"> 用户名:</td>
          <td>
          	<input type="text" name="user_name" value="<?php echo $_smarty_tpl->tpl_vars['user_edit']->value['user_name'];?>
" <?php if ($_smarty_tpl->tpl_vars['user_edit']->value['user_id']){?> disabled="disabled" <?php }?> placeholder="请输入用户名" required>&nbsp;&nbsp;&nbsp;&nbsp;
            <span id="users"></span>  
          </td>
        </tr>
        <tr>
          <td class="firtd"> 登录密码:</td>
          <td><input type="password" name="password" value="" maxlength="20" required></td>
        </tr>
        <tr>
          <td class="firtd"> 确认密码:</td>
          <td><input type="password" name="repassword" value="" maxlength="20" required><span id="repassword"></span></td>
        </tr>
        <tr>
          <td class="firtd"> 会员等级:</td>     
          <td>
          	<select name="user_rank" id="">
            <?php  $_smarty_tpl->tpl_vars['ranks'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['ranks']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['user_rank']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['ranks']->key => $_smarty_tpl->tpl_vars['ranks']->value){
$_smarty_tpl->tpl_vars['ranks']->_loop = true;
?>
            <option <?php if ($_smarty_tpl->tpl_vars['user_edit']->value['user_rank']==$_smarty_tpl->tpl_vars['ranks']->value['rank_id']){?> selected="selected" required <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['ranks']->value['rank_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ranks']->value['rank_name'];?>
</option>
            <?php } ?>
            </select>
          </td>
        </tr>
        <tr>
        	<td class="firtd"> 昵称:</td>
        	<td><input type="text" name="alias" value="<?php echo $_smarty_tpl->tpl_vars['user_edit']->value['alias'];?>
" required></td>
        </tr>
        <tr>
        	<td class="firtd"> 性别:</td>
        	<td><input style="width:15px" type="radio" name="sex" <?php if ($_smarty_tpl->tpl_vars['user_edit']->value['sex']==1){?>checked<?php }?> value="1"> 男 &nbsp;&nbsp;&nbsp;&nbsp;<input style="width:15px" <?php if ($_smarty_tpl->tpl_vars['user_edit']->value['sex']==0){?>checked<?php }?> type="radio" name="sex" value="0"> 女</td>
        </tr>
        <tr>
        	<td class="firtd"> 邮箱:</td>
        	<td><input type="text" name="email" value="<?php echo $_smarty_tpl->tpl_vars['user_edit']->value['email'];?>
" required>&nbsp;&nbsp;&nbsp;&nbsp;<span id="email"></span></td>
        </tr>
        <tr>
        	<td class="style1">&nbsp;</td>
        	<td>
          		<input type="hidden" name="act" value="insert">
            	<input type="hidden" name="user_id" value="<?php echo $_smarty_tpl->tpl_vars['user_edit']->value['user_id'];?>
">
            	<a href="JavaScript:void(0);" class="btn" onclick="reset()"><span>重置</span></a>
            	<a href="JavaScript:void(0);" class="btn" onclick="$('#tj').click()"><span>确认提交</span></a>
            </td>
        </tr>
      </tbody>
    </table>
    <input type="reset" id="cz" style="display: none;">
    <input type="submit" id="tj" style="display:none;";>
  </form>
</div>
</body>
<script>
    // 重置方法
    function reset(){
        $('input').val('');
        $('textarea').text('');
    }
	$("input[name=user_name]").focus(function(){
		 $(this).next('span').html('');
		 $(this).next('span').css('color','#00f')
		 $(this).css('border-color','#ccc');
	});
	//验证用户名是否为手机号或用户名是否已经存在
	$("input[name=user_name]").blur(function(){
		$(this).data('type','1');
		vals=$(this).val();
		perg=/^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/;
		if(vals.match(perg)){
			$.post("users.php",{act:'user_name',user_name:vals},function(data){
				if(data==1){
					$("input[name=user_name]").next('span').html('手机号已存在');
					$("input[name=user_name]").next('span').css('color','#f00')
					$("input[name=user_name]").css('border-color','#f00');
				}else{
					$("input[name=user_name]").next('span').html('正确');
					$("input[name=user_name]").next('span').css('color','#90B71B')
					$("input[name=user_name]").css('border-color','#ccc');
					$("input[name=user_name]").data('type','2');
				}
			});
		}else{
			$(this).next('span').html('请输入正确的手机号');
			$(this).next('span').css('color','#f00')
			$(this).css('border-color','#f00');
		}
	});
	//验证密码是否一致
	$("input[name=repassword]").blur(function(){
		$(this).data('type','1');
		val=$("input[name=password]").val();
		vals=$(this).val();
		if(vals==''){
			$(this).next('span').html('密码不能为空');
		 	$(this).next('span').css('color','#f00')
			$(this).css('border-color','#f00');
		}else{
			if(val==vals){
				$(this).next('span').html('正确');
				$(this).next('span').css('color','#90B71B')
				$(this).css('border-color','#ccc');
				$(this).data('type','2');
			}else{
				$(this).next('span').html('两次密码输入不一致');
				$(this).next('span').css('color','#f00')
				$(this).css('border-color','#f00');
			}
		}
	});
	//邮箱正则匹配
	$("input[name=email]").blur(function(){
		$(this).data('type','1');
		vals=$(this).val();
		perg=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		if(vals.match(perg)){
			$(this).next('span').html('邮箱正确');
		 	$(this).next('span').css('color','#90B71B')
		 	$(this).css('border-color','#ccc');
			$(this).data('type','2');
		}else{
			$(this).next('span').html('格式有误');
		 	$(this).next('span').css('color','#f00')
			$(this).css('border-color','#f00');
		}
	});
	//submit提交
	$("form").submit(function(){
 	  if($("input[name=user_name]").data('type')==2){
         if($("input[name=repassword]").data('type')==2){
         		 if($("input[name=email]").data('type')==2){
         		
				 }else{
					   	 $("input[name=email]").focus();
						 $("input[name=email]").next('span').html('格式有误');
					 	 $("input[name=email]").next('span').css('color','#f00')
						 $("input[name=email]").css('border-color','#f00');
						return false;  
				 }	
  	 	 }else{
				 $("input[name=repassword]").focus();
				 $("input[name=repassword]").next('span').html('密码不一致');
				 $("input[name=repassword]").next('span').css('color','#f00')
				 $("input[name=repassword]").css('border-color','#f00'); 
				 return false;  
	 	 }	
  	  }else{
		 $("input[name=user_name]").focus();
		 $("input[name=user_name]").next('span').html('格式有误');
		 $("input[name=user_name]").next('span').css('color','#f00')
		 $("input[name=user_name]").css('border-color','#f00');
		 return false;  
	  }
});

</script>
</html><?php }} ?>